home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / superv22.zip / POSTLOAD.PAS < prev    next >
Pascal/Delphi Source File  |  1987-02-10  |  2KB  |  76 lines

  1. {                         DUMBTERM/POSTLOAD
  2.          Plain vanilla comm program to demonstrate SUPERCOM.PAS
  3.          In addition, demonstrates how to postload SUPER.COM from
  4.          Turbo Pascal}
  5. {
  6.            (C) Copyright 1986, Doctor Debug/Steel City Software
  7.                             All Rights Reserved
  8.  
  9.       SUPER.COM must be loaded for this program to function correctly    
  10.  
  11. Do not run this program from the Turbo environment! Compile to a COM
  12. file first! Be sure to set the Maximum Free Dynamic Memory (in the
  13. Turbo Options menu) to 1000H or less. (400 is enough).
  14.  
  15.                         To exit program, type Ctrl-Z
  16. }
  17.  
  18. {$ISupercom.Pas}      {Bring in Comm library}
  19. {$iExec.Pas}          {Routines to execute another program from Turbo}
  20.  
  21. Var
  22.       x:LString; {255 byte string - defined in SUPERCOM library}
  23.       a,a1:char;
  24.       i,b,c:integer;
  25.       FilVar: Text;
  26.       FileName: String[14];
  27.       Code: integer;
  28.       KeyCode: byte; {needed for GetChar to work}
  29.  
  30. {$iGetChar}           {Function to read a character}
  31.  
  32. Begin   {Main Program}
  33.    code := ExecCommand('Super /X');
  34.    {code will have error code is it didn't load}
  35.    If (code <> 0) then
  36.    Begin
  37.       Writeln('Unable to Post-Load SUPERCOM.');
  38.       Halt;
  39.    End;
  40.    If not(SuperComPresent) then
  41.    Begin
  42.       Writeln('Unable to Post-Load SUPERCOM.');
  43.       Halt;
  44.    End;
  45.  
  46.    (* Now we can procede normally *)
  47.  
  48.    writeln ('Opening Supercom Port');
  49.    InitPort(1,1200,Even,7,1);    {opens port 1}
  50.    ClearBuff;    {make sure buffer empty}
  51.    FileName := 'TEXT.TXT';
  52.    Assign(FilVar,FileName);    {open file for capture}
  53.    Rewrite(FilVar);      {write from beginning}
  54.    a := ' ';
  55.    while a <> Chr(26)    {26 = end of file char}
  56.    Begin
  57.       if keypressed then  {this loop if key was pressed}
  58.       begin
  59.          a := GetChar;   {get keypress}
  60.          If a <> chr(26) then   {control Z? (signifies end)}
  61.             XmitCh(a);    {no, send character}
  62.       end;
  63.       c := rlen;    {# of chars in input buffer}
  64.       If c <> 0 then    {this loop if there are chars}
  65.       begin
  66.          if abs(c) > 255 then    {only get blocks of 255}
  67.             c := 255;
  68.          recblk(c,x);    {input data into x array}
  69.          Write(x);
  70.          Write(FilVar,x);
  71.       end;  {if}
  72.    end; {while}
  73.    Close(FilVar);     {close output file}
  74.    KillPort;     {close Supercom port and remove from memory}
  75. end.     {Done!}
  76.